/************************************************************************/
/*  									*/
/*  writecdwd_MSEerr.c							*/
/*									*/
/*  Tom Lookabaugh							*/
/*  August 15, 1987							*/
/*  Last Revision: August 15, 1987					*/
/*									*/
/*  DESCRIPTION								*/
/*	Writes the error signal between input and vector quantizer	*/
/*	reproduction.							*/
/*  RETURNS								*/
/*	No significant value.  						*/
/*  CALLS								*/
/*	error()								*/
/*									*/
/************************************************************************/

#include "stdvq.h"

writecdwd (cdbk, cdwd, dist, tsvect, cdbksz, outfile) 

    double *cdbk;	/* codebook					*/
    int cdwd;		/* index of desired codeword			*/
    double dist;	/* distortion to closest codeword		*/
    double* tsvect;     /* current test sequence vector                 */
    int cdbksz;		/* size of codebook				*/
    FILE *outfile;	/* reproductions file				*/
    
{
    int d; 		/* iteration counter				*/
    
    for (d = 0; d < dim; d++) tsvect[d] -= cdbk[cdwd*cdbkdim + d];
    
    if (fwrite(tsvect, sizeof(double), dim, outfile) !=
      dim) error("failed to write codeword (writecdwd 1)");


}
